#include <cstdio>

int main( )
{
    int t, n;
    bool flag;
    scanf("%d", &t);
    while ( t-- )
    {
        scanf("%d", &n);
        flag = false;
        while ( n > 1 )
        {
            while ( n % 2 == 0 ) n /= 2;
            if ( n == 1 )
                break;
            if ( flag ) printf(" ");
            printf("%d", n);
            flag = true;
            n = n * 3 + 1;
        }
        if ( !flag ) puts("No number can be output !");
        else printf("\n");
    }
    return 0;
}
